<?php
 if(!isset($_SESSION)) 
{ 
session_start(); 
}  
if(!isset($_SESSION['db'])){
	$addressbrowser = $_SERVER['SERVER_NAME'];
	$temp = explode(".", $addressbrowser);
	$connection = mysql_connect("1.234.53.52", "cam", "5678" ) ;
	//$connection = mysql_connect("localhost", "root", "root" ) ;
	mysql_select_db("elihan", $connection);
	mysql_query("set names 'utf8'");
	$selectdatabase = mysql_query("SELECT am.DatabaseName,am.Logo from ac_eli_manager am where am.KeyName='$temp[0]' and am.`Status` = 2");
	$result = mysql_fetch_assoc($selectdatabase);

	$_SESSION['Logo']=$result[Logo];
	$_SESSION['db']= $result[DatabaseName];
	mysql_close($connection);
}
$database = $_SESSION['db'];
$connectadmin = mysql_connect("1.234.53.52", "cam", "5678") or die("Không kết nối được database");
//$connectadmin = mysql_connect("localhost", "root", "root") or die("Không kết nối được database");
		mysql_select_db("elihan", $connectadmin);
		mysql_query("set names 'utf8'");
		

$namecomp = $_REQUEST['compname'];
$email = $_REQUEST['email'];
$phone = $_REQUEST['phone'];
$website = $_REQUEST['website'];
$address = $_REQUEST['address'];
$business = $_REQUEST['business'];
$corporate = $_REQUEST['corporate'];

if(isset($_REQUEST['updateprofilecomp'])){
$sqlupdate = "update ac_eli_manager set PartnerName='$namecomp',Email='$email',Phone='$phone',Website='$website',
	Address='$address',BusinessNumber='$business',CorporateNumber='$corporate' where DatabaseName='$database'";
mysql_query($sqlupdate);

}

mysql_close($connectadmin);

if(isset($_REQUEST['updateprofilecomp'])){
	$_SESSION['alert'] ="";
	header("Location: ../../companyprofileAdmin.php");
	
}
?>
